﻿Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient

Public Class frmTenNhanVien
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents btnNew As System.Windows.Forms.Button
    Friend WithEvents btnSave As System.Windows.Forms.Button
    Friend WithEvents btnDelete1 As System.Windows.Forms.Button
    Friend WithEvents txtTen As System.Windows.Forms.TextBox
    Friend WithEvents txtMa As System.Windows.Forms.TextBox
    Friend WithEvents txtDiaChi As System.Windows.Forms.TextBox
    Friend WithEvents BtnClose As System.Windows.Forms.Button
    Friend WithEvents MatinhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TentinhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MamienDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents DataGridView1 As System.Windows.Forms.DataGridView
    Friend WithEvents TxtChucVu As System.Windows.Forms.TextBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents TxtDienThoai As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents TxtEmail As System.Windows.Forms.TextBox
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents TxtFax As System.Windows.Forms.TextBox
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents TxtTrinhDo As System.Windows.Forms.TextBox
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents TxtGhiChu As System.Windows.Forms.TextBox
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents TblnhanvienBindingSource As System.Windows.Forms.BindingSource
    Friend WithEvents DataSetForm_Sop As PHUQUI.DataSetForm_Sop
    Friend WithEvents ManhacungcapDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TennhacungcapDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents DiachinhacungcapDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MasothueDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents DienthoaiDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents FaxDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents EmailDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents so_taikhoan As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MucnoDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents BtnIn As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmTenNhanVien))
        Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle
        Me.btnSave = New System.Windows.Forms.Button
        Me.txtDiaChi = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.txtTen = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.txtMa = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.btnNew = New System.Windows.Forms.Button
        Me.btnDelete1 = New System.Windows.Forms.Button
        Me.BtnClose = New System.Windows.Forms.Button
        Me.BtnIn = New System.Windows.Forms.Button
        Me.DataGridView1 = New System.Windows.Forms.DataGridView
        Me.ManhacungcapDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TennhacungcapDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.DiachinhacungcapDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.MasothueDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.DienthoaiDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.FaxDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.EmailDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.so_taikhoan = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.MucnoDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TblnhanvienBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.DataSetForm_Sop = New PHUQUI.DataSetForm_Sop
        Me.TxtChucVu = New System.Windows.Forms.TextBox
        Me.Label5 = New System.Windows.Forms.Label
        Me.TxtDienThoai = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.TxtEmail = New System.Windows.Forms.TextBox
        Me.Label7 = New System.Windows.Forms.Label
        Me.TxtFax = New System.Windows.Forms.TextBox
        Me.Label8 = New System.Windows.Forms.Label
        Me.TxtTrinhDo = New System.Windows.Forms.TextBox
        Me.Label9 = New System.Windows.Forms.Label
        Me.TxtGhiChu = New System.Windows.Forms.TextBox
        Me.Label10 = New System.Windows.Forms.Label
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.TblnhanvienBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.DataSetForm_Sop, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'btnSave
        '
        Me.btnSave.BackColor = System.Drawing.Color.Transparent
        Me.btnSave.Image = CType(resources.GetObject("btnSave.Image"), System.Drawing.Image)
        Me.btnSave.Location = New System.Drawing.Point(240, 166)
        Me.btnSave.Name = "btnSave"
        Me.btnSave.Size = New System.Drawing.Size(96, 24)
        Me.btnSave.TabIndex = 4
        Me.btnSave.UseVisualStyleBackColor = False
        '
        'txtDiaChi
        '
        Me.txtDiaChi.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtDiaChi.Location = New System.Drawing.Point(112, 60)
        Me.txtDiaChi.MaxLength = 100
        Me.txtDiaChi.Name = "txtDiaChi"
        Me.txtDiaChi.Size = New System.Drawing.Size(576, 22)
        Me.txtDiaChi.TabIndex = 3
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(54, 60)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(54, 16)
        Me.Label4.TabIndex = 16
        Me.Label4.Text = "Địa Chỉ"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtTen
        '
        Me.txtTen.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtTen.Location = New System.Drawing.Point(312, 36)
        Me.txtTen.MaxLength = 50
        Me.txtTen.Name = "txtTen"
        Me.txtTen.Size = New System.Drawing.Size(376, 22)
        Me.txtTen.TabIndex = 2
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(253, 38)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(59, 16)
        Me.Label3.TabIndex = 14
        Me.Label3.Text = "Tên NV"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'txtMa
        '
        Me.txtMa.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtMa.Location = New System.Drawing.Point(112, 36)
        Me.txtMa.MaxLength = 10
        Me.txtMa.Name = "txtMa"
        Me.txtMa.Size = New System.Drawing.Size(138, 22)
        Me.txtMa.TabIndex = 1
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(51, 38)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(57, 16)
        Me.Label2.TabIndex = 12
        Me.Label2.Text = "Mã NV"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(223, 4)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(379, 24)
        Me.Label1.TabIndex = 11
        Me.Label1.Text = "DANH MỤC TÊN NHÂN VIÊN "
        '
        'btnNew
        '
        Me.btnNew.Image = CType(resources.GetObject("btnNew.Image"), System.Drawing.Image)
        Me.btnNew.Location = New System.Drawing.Point(132, 166)
        Me.btnNew.Name = "btnNew"
        Me.btnNew.Size = New System.Drawing.Size(96, 24)
        Me.btnNew.TabIndex = 5
        '
        'btnDelete1
        '
        Me.btnDelete1.Image = CType(resources.GetObject("btnDelete1.Image"), System.Drawing.Image)
        Me.btnDelete1.Location = New System.Drawing.Point(347, 166)
        Me.btnDelete1.Name = "btnDelete1"
        Me.btnDelete1.Size = New System.Drawing.Size(96, 24)
        Me.btnDelete1.TabIndex = 29
        '
        'BtnClose
        '
        Me.BtnClose.Image = CType(resources.GetObject("BtnClose.Image"), System.Drawing.Image)
        Me.BtnClose.Location = New System.Drawing.Point(569, 166)
        Me.BtnClose.Name = "BtnClose"
        Me.BtnClose.Size = New System.Drawing.Size(96, 24)
        Me.BtnClose.TabIndex = 30
        '
        'BtnIn
        '
        Me.BtnIn.Image = CType(resources.GetObject("BtnIn.Image"), System.Drawing.Image)
        Me.BtnIn.Location = New System.Drawing.Point(457, 166)
        Me.BtnIn.Name = "BtnIn"
        Me.BtnIn.Size = New System.Drawing.Size(96, 24)
        Me.BtnIn.TabIndex = 39
        '
        'DataGridView1
        '
        Me.DataGridView1.AllowUserToAddRows = False
        Me.DataGridView1.AllowUserToDeleteRows = False
        Me.DataGridView1.AllowUserToResizeColumns = False
        Me.DataGridView1.AutoGenerateColumns = False
        Me.DataGridView1.BackgroundColor = System.Drawing.Color.LightBlue
        DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
        DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control
        DataGridViewCellStyle1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText
        DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight
        DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText
        DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
        Me.DataGridView1.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1
        Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
        Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.ManhacungcapDataGridViewTextBoxColumn, Me.TennhacungcapDataGridViewTextBoxColumn, Me.DiachinhacungcapDataGridViewTextBoxColumn, Me.MasothueDataGridViewTextBoxColumn, Me.DienthoaiDataGridViewTextBoxColumn, Me.FaxDataGridViewTextBoxColumn, Me.EmailDataGridViewTextBoxColumn, Me.so_taikhoan, Me.MucnoDataGridViewTextBoxColumn})
        Me.DataGridView1.DataSource = Me.TblnhanvienBindingSource
        Me.DataGridView1.Location = New System.Drawing.Point(35, 199)
        Me.DataGridView1.Name = "DataGridView1"
        Me.DataGridView1.ReadOnly = True
        Me.DataGridView1.RowHeadersWidth = 20
        Me.DataGridView1.Size = New System.Drawing.Size(726, 372)
        Me.DataGridView1.TabIndex = 40
        '
        'ManhacungcapDataGridViewTextBoxColumn
        '
        Me.ManhacungcapDataGridViewTextBoxColumn.DataPropertyName = "ma_nhacungcap"
        Me.ManhacungcapDataGridViewTextBoxColumn.HeaderText = "Mã"
        Me.ManhacungcapDataGridViewTextBoxColumn.Name = "ManhacungcapDataGridViewTextBoxColumn"
        Me.ManhacungcapDataGridViewTextBoxColumn.ReadOnly = True
        Me.ManhacungcapDataGridViewTextBoxColumn.Width = 40
        '
        'TennhacungcapDataGridViewTextBoxColumn
        '
        Me.TennhacungcapDataGridViewTextBoxColumn.DataPropertyName = "ten_nhacungcap"
        Me.TennhacungcapDataGridViewTextBoxColumn.HeaderText = "Tên"
        Me.TennhacungcapDataGridViewTextBoxColumn.Name = "TennhacungcapDataGridViewTextBoxColumn"
        Me.TennhacungcapDataGridViewTextBoxColumn.ReadOnly = True
        Me.TennhacungcapDataGridViewTextBoxColumn.Width = 160
        '
        'DiachinhacungcapDataGridViewTextBoxColumn
        '
        Me.DiachinhacungcapDataGridViewTextBoxColumn.DataPropertyName = "diachi_nhacungcap"
        Me.DiachinhacungcapDataGridViewTextBoxColumn.HeaderText = "Địa chỉ"
        Me.DiachinhacungcapDataGridViewTextBoxColumn.Name = "DiachinhacungcapDataGridViewTextBoxColumn"
        Me.DiachinhacungcapDataGridViewTextBoxColumn.ReadOnly = True
        Me.DiachinhacungcapDataGridViewTextBoxColumn.Width = 175
        '
        'MasothueDataGridViewTextBoxColumn
        '
        Me.MasothueDataGridViewTextBoxColumn.DataPropertyName = "maso_thue"
        Me.MasothueDataGridViewTextBoxColumn.HeaderText = "chucvu"
        Me.MasothueDataGridViewTextBoxColumn.Name = "MasothueDataGridViewTextBoxColumn"
        Me.MasothueDataGridViewTextBoxColumn.ReadOnly = True
        Me.MasothueDataGridViewTextBoxColumn.Visible = False
        Me.MasothueDataGridViewTextBoxColumn.Width = 70
        '
        'DienthoaiDataGridViewTextBoxColumn
        '
        Me.DienthoaiDataGridViewTextBoxColumn.DataPropertyName = "dienthoai"
        Me.DienthoaiDataGridViewTextBoxColumn.HeaderText = "Điện thoại"
        Me.DienthoaiDataGridViewTextBoxColumn.Name = "DienthoaiDataGridViewTextBoxColumn"
        Me.DienthoaiDataGridViewTextBoxColumn.ReadOnly = True
        '
        'FaxDataGridViewTextBoxColumn
        '
        Me.FaxDataGridViewTextBoxColumn.DataPropertyName = "fax"
        Me.FaxDataGridViewTextBoxColumn.HeaderText = "Fax"
        Me.FaxDataGridViewTextBoxColumn.Name = "FaxDataGridViewTextBoxColumn"
        Me.FaxDataGridViewTextBoxColumn.ReadOnly = True
        '
        'EmailDataGridViewTextBoxColumn
        '
        Me.EmailDataGridViewTextBoxColumn.DataPropertyName = "email"
        Me.EmailDataGridViewTextBoxColumn.HeaderText = "Email"
        Me.EmailDataGridViewTextBoxColumn.Name = "EmailDataGridViewTextBoxColumn"
        Me.EmailDataGridViewTextBoxColumn.ReadOnly = True
        Me.EmailDataGridViewTextBoxColumn.Width = 120
        '
        'so_taikhoan
        '
        Me.so_taikhoan.DataPropertyName = "so_taikhoan"
        Me.so_taikhoan.HeaderText = "ghichu"
        Me.so_taikhoan.Name = "so_taikhoan"
        Me.so_taikhoan.ReadOnly = True
        Me.so_taikhoan.Visible = False
        '
        'MucnoDataGridViewTextBoxColumn
        '
        Me.MucnoDataGridViewTextBoxColumn.DataPropertyName = "mucno"
        Me.MucnoDataGridViewTextBoxColumn.HeaderText = "Trinhdo"
        Me.MucnoDataGridViewTextBoxColumn.Name = "MucnoDataGridViewTextBoxColumn"
        Me.MucnoDataGridViewTextBoxColumn.ReadOnly = True
        Me.MucnoDataGridViewTextBoxColumn.Visible = False
        Me.MucnoDataGridViewTextBoxColumn.Width = 80
        '
        'TblnhanvienBindingSource
        '
        Me.TblnhanvienBindingSource.DataMember = "tbl_nhanvien"
        Me.TblnhanvienBindingSource.DataSource = Me.DataSetForm_Sop
        '
        'DataSetForm_Sop
        '
        Me.DataSetForm_Sop.DataSetName = "DataSetForm_Sop"
        Me.DataSetForm_Sop.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
        '
        'TxtChucVu
        '
        Me.TxtChucVu.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtChucVu.Location = New System.Drawing.Point(112, 85)
        Me.TxtChucVu.MaxLength = 100
        Me.TxtChucVu.Name = "TxtChucVu"
        Me.TxtChucVu.Size = New System.Drawing.Size(240, 22)
        Me.TxtChucVu.TabIndex = 41
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(54, 88)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(54, 16)
        Me.Label5.TabIndex = 42
        Me.Label5.Text = "Chức Vụ"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TxtDienThoai
        '
        Me.TxtDienThoai.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtDienThoai.Location = New System.Drawing.Point(433, 85)
        Me.TxtDienThoai.MaxLength = 100
        Me.TxtDienThoai.Name = "TxtDienThoai"
        Me.TxtDienThoai.Size = New System.Drawing.Size(255, 22)
        Me.TxtDienThoai.TabIndex = 43
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(353, 88)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(76, 16)
        Me.Label6.TabIndex = 44
        Me.Label6.Text = "Điện Thoại"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'TxtEmail
        '
        Me.TxtEmail.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtEmail.Location = New System.Drawing.Point(433, 110)
        Me.TxtEmail.MaxLength = 100
        Me.TxtEmail.Name = "TxtEmail"
        Me.TxtEmail.Size = New System.Drawing.Size(255, 22)
        Me.TxtEmail.TabIndex = 47
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(353, 113)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(76, 16)
        Me.Label7.TabIndex = 48
        Me.Label7.Text = "Email"
        Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'TxtFax
        '
        Me.TxtFax.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtFax.Location = New System.Drawing.Point(112, 110)
        Me.TxtFax.MaxLength = 100
        Me.TxtFax.Name = "TxtFax"
        Me.TxtFax.Size = New System.Drawing.Size(240, 22)
        Me.TxtFax.TabIndex = 45
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(54, 113)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(54, 16)
        Me.Label8.TabIndex = 46
        Me.Label8.Text = "Số Fax"
        Me.Label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TxtTrinhDo
        '
        Me.TxtTrinhDo.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtTrinhDo.Location = New System.Drawing.Point(433, 135)
        Me.TxtTrinhDo.MaxLength = 100
        Me.TxtTrinhDo.Name = "TxtTrinhDo"
        Me.TxtTrinhDo.Size = New System.Drawing.Size(255, 22)
        Me.TxtTrinhDo.TabIndex = 51
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(353, 138)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(76, 16)
        Me.Label9.TabIndex = 52
        Me.Label9.Text = "Trình Độ"
        Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'TxtGhiChu
        '
        Me.TxtGhiChu.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TxtGhiChu.Location = New System.Drawing.Point(112, 135)
        Me.TxtGhiChu.MaxLength = 100
        Me.TxtGhiChu.Name = "TxtGhiChu"
        Me.TxtGhiChu.Size = New System.Drawing.Size(240, 22)
        Me.TxtGhiChu.TabIndex = 49
        '
        'Label10
        '
        Me.Label10.Location = New System.Drawing.Point(54, 138)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(54, 16)
        Me.Label10.TabIndex = 50
        Me.Label10.Text = "Ghi Chú"
        Me.Label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'frmTenNhanVien
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.LightBlue
        Me.ClientSize = New System.Drawing.Size(792, 573)
        Me.Controls.Add(Me.TxtTrinhDo)
        Me.Controls.Add(Me.Label9)
        Me.Controls.Add(Me.TxtGhiChu)
        Me.Controls.Add(Me.Label10)
        Me.Controls.Add(Me.TxtEmail)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.TxtFax)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.TxtDienThoai)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.TxtChucVu)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.DataGridView1)
        Me.Controls.Add(Me.BtnIn)
        Me.Controls.Add(Me.BtnClose)
        Me.Controls.Add(Me.txtDiaChi)
        Me.Controls.Add(Me.txtTen)
        Me.Controls.Add(Me.txtMa)
        Me.Controls.Add(Me.btnDelete1)
        Me.Controls.Add(Me.btnNew)
        Me.Controls.Add(Me.btnSave)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Name = "frmTenNhanVien"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Danh Muc Ten Nhan Vien"
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.TblnhanvienBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.DataSetForm_Sop, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region
    Private data1 As DataTable
    Private da As MySqlDataAdapter
    Dim myDT As New DataTable
    Dim strError As String = ""
    Dim myform As Form
    Dim sqlQuery As String = ""
    Sub SetclearData()
        txtMa.Text = ""
        txtTen.Text = ""
        txtDiaChi.Text = ""
        TxtChucVu.Text = ""
        TxtDienThoai.Text = ""
        TxtFax.Text = ""
        TxtEmail.Text = ""
        TxtGhiChu.Text = ""
        TxtTrinhDo.Text = ""
    End Sub
    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        ' Kiểm tra có nhập liệu chưa ?
        If Me.checkInput(txtMa.Text, txtTen.Text) Then
            Dim txtMaTinh = Me.txtMa.Text.Trim
            sqlQuery = "SELECT ma_nhacungcap FROM tbl_nhanvien WHERE ma_nhacungcap = '" & txtMaTinh & "'"
            Dim existedMaTinh As Integer = moduleDatabaseConn.CheckRecordExisted(sqlQuery)
            If existedMaTinh = 1 Then ' Update record
                sqlQuery = "UPDATE tbl_nhanvien "
                sqlQuery += "SET "
                sqlQuery += "ma_nhacungcap = '" & txtMaTinh & "'"
                sqlQuery += ", ten_nhacungcap = '" & Me.txtTen.Text.Trim & "'"
                sqlQuery += ", diachi_nhacungcap = '" & Me.txtDiaChi.Text.Trim & "'"
                sqlQuery += ", maso_thue = '" & Me.TxtChucVu.Text.Trim & "'"
                sqlQuery += ", dienthoai = '" & Me.TxtDienThoai.Text.Trim & "'"
                sqlQuery += ", fax = '" & Me.TxtFax.Text.Trim & "'"
                sqlQuery += ", email = '" & Me.TxtEmail.Text.Trim & "'"
                sqlQuery += ",so_taikhoan = '" & Me.TxtGhiChu.Text.Trim & "'"
                sqlQuery += ",mucno = '" & Me.TxtTrinhDo.Text.Trim & "'"
                sqlQuery += " WHERE ma_nhacungcap= '" & txtMaTinh & "'"
                Dim updated As Integer = moduleDatabaseConn.ExecuteNonQuery(sqlQuery)
                If updated = 1 Then
                    MessageBox.Show("Cập nhật thông tin thành công !")
                    sqlQuery = "SELECT * FROM tbl_nhanvien"
                    Me.loadDanhSachTenNhanVien(sqlQuery)
                Else
                    MessageBox.Show("Cập nhật thông tin không thành công: " & globalVariale.sqlMsgError)
                End If

            Else
                If existedMaTinh = 0 Then ' Insert record
                    sqlQuery = "INSERT INTO tbl_nhanvien "
                    sqlQuery += "(ma_nhacungcap, ten_nhacungcap,diachi_nhacungcap,maso_thue,dienthoai,fax,email,so_taikhoan,mucno) "
                    sqlQuery += "VALUES "
                    sqlQuery += "("
                    sqlQuery += "'" & txtMaTinh.ToUpper & "', "
                    sqlQuery += "'" & Me.txtTen.Text.Trim & "', "
                    sqlQuery += "'" & Me.txtDiaChi.Text.Trim & "',"
                    sqlQuery += "'" & Me.TxtChucVu.Text.Trim & "',"
                    sqlQuery += "'" & Me.TxtDienThoai.Text.Trim & "',"
                    sqlQuery += "'" & Me.TxtFax.Text.Trim & "',"
                    sqlQuery += "'" & Me.TxtEmail.Text.Trim & "',"
                    sqlQuery += "'" & Me.TxtGhiChu.Text.Trim & "',"
                    sqlQuery += "'" & Me.TxtTrinhDo.Text.Trim & "'"
                    sqlQuery += ")"
                    Dim inserted As Integer = moduleDatabaseConn.ExecuteNonQuery(sqlQuery)
                    If inserted = 1 Then
                        MessageBox.Show("Thêm thông tin thành công !")
                        sqlQuery = "SELECT * FROM tbl_nhanvien"
                        Me.loadDanhSachTenNhanVien(sqlQuery)
                    Else
                        MessageBox.Show("Thêm thông tin không thành công: " & globalVariale.sqlMsgError)
                    End If
                Else ' SQLExeption: existedMaQuocGia = -1
                    MessageBox.Show("Lấy dữ liệu bị lỗi: " & globalVariale.sqlMsgError, globalVariale.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning)
                End If
            End If
        End If


    End Sub

    Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
        SetclearData()
        txtMa.Focus()
    End Sub
    Private Sub btnDelete1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete1.Click
        Dim txtMaTinh As String = Trim(Me.txtMa.Text)

        If txtMaTinh = "" Then
            MessageBox.Show("Bạn chưa chọn Mã để xóa !")
        Else
            Dim txtTenTinh As String = Trim(Me.txtTen.Text)
            moduleConstants.MessageWarning = "Bạn có muốn xóa  " & txtMaTinh & "(" & txtTenTinh & ") ?"
            globalVariale.msgTitle = "Cập nhật thông tin "
            If MessageBox.Show(moduleConstants.MessageWarning, globalVariale.msgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = MsgBoxResult.Yes Then
                Dim sqlQuery As String = "DELETE FROM tbl_nhanvien WHERE ma_nhacungcap = '" & txtMaTinh & "'"
                Dim deleting As Integer = moduleDatabaseConn.ExecuteNonQuery(sqlQuery)
                If deleting = 1 Then
                    MessageBox.Show("Xóa thông tin thành công !")
                    sqlQuery = "SELECT * FROM tbl_nhanvien"
                    Me.loadDanhSachTenNhanVien(sqlQuery)
                    SetclearData()
                Else
                    MessageBox.Show("Xóa thông tin không thành công: " & globalVariale.sqlMsgError)
                End If
            End If
        End If
    End Sub

    Private Sub frmTenNhanVien_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        moduleUtils.setDinhDangVietNam()
        Me.loadDanhSachTenNhanVien("SELECT * FROM tbl_nhanvien")
    End Sub
    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click
        Me.Close()
    End Sub
    Private Sub BtnIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnIn.Click
        '  FrmCrQuocGia.Show()
    End Sub
    Function checkInput(ByVal ma As String, ByVal ten As String) As Boolean
        Dim result As Boolean = True
        If ma = "" Then
            MessageBox.Show("Bạn chưa chọn Mã  !")
            result = False
        Else
            If ten = "" Then
                MessageBox.Show("Bạn chưa nhập tên !")
                result = False
            End If
        End If
        Return result
    End Function
    Private Sub loadDanhSachTenNhanVien(ByVal sqlQuery As String)
        Me.DataGridView1.DataSource = moduleDatabaseConn.GetDataTable(sqlQuery)
    End Sub
    Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        Dim iRow As Integer = Me.DataGridView1.CurrentRow.Index
        Me.txtMa.Text = Me.DataGridView1.Item(0, iRow).Value
        Me.txtTen.Text = Me.DataGridView1.Item(1, iRow).Value
        Me.txtDiaChi.Text = Me.DataGridView1.Item(2, iRow).Value
        Me.TxtChucVu.Text = Me.DataGridView1.Item(3, iRow).Value
        Me.TxtDienThoai.Text = Me.DataGridView1.Item(4, iRow).Value
        Me.TxtFax.Text = Me.DataGridView1.Item(5, iRow).Value
        Me.TxtEmail.Text = Me.DataGridView1.Item(6, iRow).Value
        Me.TxtGhiChu.Text = Me.DataGridView1.Item(7, iRow).Value
        Me.TxtTrinhDo.Text = Me.DataGridView1.Item(8, iRow).Value
    End Sub
End Class


